package com.wangxiang.common.utils;

import com.alibaba.fastjson.JSONObject;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class MyStringUtile {
    //spu表的skuId解析
    public ArrayList<Integer> getSkuArray(String str){
        String replace = str.replace("[", "");
        String replace1 = replace.replace("]", "");
        String replace2 = replace1.replace(" ", "");
        String[] split = replace2.split(",");
        ArrayList<Integer> integers = new ArrayList<>();
        for (String s : split) {
            int a = Integer.valueOf(s);
            integers.add(a);
        }
        return integers;
    }
    //前端传来到skuIdList是String，转为list<>
    public List<Integer> skuIdStrChangeSkuIdList(String skuIdStr){
        String replace = skuIdStr.replace("[", "");
        String replace1 = replace.replace("]", "");
        String replace2 = replace1.replace(" ", "");
        String[] split = replace2.split(",");
//        System.out.println(split);
        ArrayList<Integer> list = new ArrayList<>();
        for (String s : split) {
            Integer integer = Integer.valueOf(s);
            list.add(integer);
        }
        return list;
    }

    public static void main(String[] args) {
        String a = "[2579807, 2579808, 2579809, 2579810, 2579811, 2579812, 2579813, 2579814, 2579815, 2579816, 2579817, 2579818, 2579819, 2579820, 2579821, 2579822, 2579823, 2579824, 2579825, 2579826, 2579827, 2579828, 2579829, 2579830, 2579831, 2579832, 2579833, 2579834, 2579835, 2579836, 2579837, 2579838, 2579839, 2579840, 2579841, 2579842, 2579843, 2579844, 2579845, 2579846, 2579847, 2579848, 2579849, 2579850, 2579851, 2579852, 2579853, 2579854, 2579855, 2579856, 2579857, 2579858, 2579859, 2579860, 2579861, 2579862, 2579863, 2579864, 2579865, 2579866, 2579867, 2579868, 2579869, 2579870, 2579871, 2579872, 2579873, 2579874, 2579875, 2579876, 2579877, 2579878, 2579879, 2579880, 2579881, 2579882, 2579883, 2579884, 2579885, 2579886]";
        MyStringUtile myStringUtile = new MyStringUtile();
        myStringUtile.skuIdStrChangeSkuIdList(a);


    }




}
